package view.quest
{
import flash.display.MovieClip;
import flash.geom.Point;

import framework.core.popup.PopUpManager;
import framework.view.components.Component;

import quest.uiproxy.QuestUIEvent;

import values.quest.QuestValue;

public class QuestComponent extends Component implements IQuestComponent
{
	public function QuestComponent()
	{
		super();
	}
	//==========================================================================
	//  Variables
	//==========================================================================
	protected var skin:MovieClip;
	protected var proxy:QuestComponentProxyBase;
	//==========================================================================
	//  Properties
	//==========================================================================
	public function set data(questValue:QuestValue):void
	{
		proxy.data = questValue;
	}
	
	public function get data():QuestValue
	{
		return proxy.data;
	}
	//==========================================================================
	//  Overridden methods: Component
	//==========================================================================
	override public function initialize():void
	{
		super.initialize();
	}
	
	public function show():void
	{
		PopUpManager.show(this, false, new Point(x, y), true);
	}
	
	public function close():void
	{
		PopUpManager.close(this);
	}
	
	protected function uiComplete():void
	{
		var evt:QuestUIEvent = new QuestUIEvent(QuestUIEvent.UI_COMPLETE, true);
		evt.questValue = data;
		dispatchEvent(evt);
	}
}
}